package com.cskaoyan.market.util;

/**
 * @author 小焦
 * @since 2023/03/18 23:45
 */
public enum FileResponseCode {

	TYPE_MISMATCH(250, "文件类型不匹配"), SIZE_MISMATCH(251, "文件大小不得超过500kb"), CREATE_FAILED(252, "文件上传失败"),
	CREATE_SUCCESS(0, "上传成功");

	// 成员变量
	private Integer code;
	private String msg;

	// 构造方法

	FileResponseCode(Integer code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	// 普通方法
	public static String getMsg(int code) {
		for (FileResponseCode value : FileResponseCode.values()) {
			if (value.getCode() == code) {
				return value.getMsg();
			}
		}
		return null;
	}

	// get set 方法

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
}

